POV-Ray : Newsgroups : povray.programming : Feature request - round : Feature request - round Server Time
28 Jun 2024 02:20:50 EDT (-0400)
  Feature request - round  
From: Thomas A  Fine
Date: 29 Nov 2004 16:29:21
Message: <41ab94b1$1@news.povray.org>
Hi,

After working for a bit with CSG objects, there's one feature that I
want again and again, which would be massively, dramatically useful.

If I could round the edges on objects automatically, without patching
together lots of cylinders and spheres and toruses, life would be VASTLY
simpler.

For example:
  box { <0,0,0> <1,1,1> round 0.1 }

would create a box with all the edges and corners rounded with a 0.1 unit
radius curve.  To construct this from separate objects requires 3 boxes,
8 spheres, and 12 cyliners -- 23 objects in total.  This should not simply
be for shading -- it would need to change the outline of the shape.

Rounding out cones in particular would be helpful, because to smoothly
transition between a cone and a torus requires some manual calculations
from the cone slope angle to get both the position and diameter of a
rounding torus.

But I want more than simply rounding out boxes, cones, and cylinders.
To really be useful, round would need to work with all of the CSG
operators (union, difference, etc.)

Consider this:
difference {
  box { <0,0,0> <24,16,60> round 1 }
  cylinder { <12,16,6> <12,16,54> 8 round 8 }
  round 3
}

This makes a nice bathtub, with rounded everything.  The box of the tub
is rounded with a one unit radius.  The interior of the tub is a big
pill shape that if done with CSG would be two spheres of radius 8 
attached to a shorter cylinder of radius 8.  And finally, the transition
between the tub box and the interior would be rounded smooth with a
3 unit radius.  Just try to make this with just CSG - you're looking at
somewhere around 35 objects.

Even that's not the greatest help.  Suppose you subtract a tilted
cone from a box, and you need to round the resulting edge.  The
resulting shape is a parabola (or is it a hyperbola?).  This would not
be easy to round -- could a torus be stretched to match, or would you
need to match a sphere_sweep to the resulting edge?

And when unioning two objects together, any "inside" joints would need
to be filled in (gussetted) to the appropriate roundness.  This is even
more complicated to pull off with CSG, as anyone who has tried it
knows.  I thought maybe you could have separate "gusset" and "round"
values, but I haven't been able to think up a single CSG operation
which will create both inside and outside edges, so it probably
wouldn't be needed.

The default value for "round" would of course be zero.

Implementing rounding of exterior corners should not be terribly hard.
Once you've hit an object, see if you are close to an edge, you need to
do an extra calculation for the intersection point and normal, and in some
cases may need to decide that you actually missed the object.

Implementing gussetting would be tougher, since a gusset will enlarge the
outline of an object.  In this case, if you miss an object you need to
check to see if you missed it close enough that you need to check to see
if a gusset must be filled in.  Otherwise, once hit processing would be
very similar to rounding.

This could definitely slow down rendering substantially.  It's definitely
designed to reduce development time, not rendering time.  But given that
you'll end up with so many fewer CSG objects, it's still possible that it
would compete well at render time.

So, those who know the code inside and out, is this doable?  Fairly
simple change?  Nightmarish change, due to the order things are
processed?  I'm willing to work on the implementation myself, but I'm
not going to waste my time if the experts tell me that the code would
have to be completely restructured to support such a feature.

         tom


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.